﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.IO;

namespace SystemModule
{
    /// <summary>
    /// 连击 追心刺消息结构体
    /// </summary>
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public struct TBatterZhuiXinMessage
    {
        public TDefaultMessage Defmsg;
        public TCharDesc desc;
        public ushort X;
        public ushort Y;
        public byte dir;

        public byte[] ToByte()
        {
            using (var memoryStream = new MemoryStream())
            {
                var backingStream = new BinaryWriter(memoryStream);
                backingStream.Write(Defmsg.ToByte());
                backingStream.Write(desc.ToByte());
                backingStream.Write(X);
                backingStream.Write(Y);
                backingStream.Write(dir);

                var stream = backingStream.BaseStream as MemoryStream;
                return stream.ToArray();
            }
        }
    }
}
